package net.weitalk.newfeatures.returncode;

import java.security.NoSuchAlgorithmException;

public sealed abstract class Digest {
    abstract byte[] digest(byte[] metrics);
    
    private static final class SHA256 extends Digest {
        @Override
        byte[] digest(byte[] metrics) {
            return new byte[0];
        }
    }
    
    private static final class SHA512 extends Digest {
        @Override
        byte[] digest(byte[] metrics) {
            return new byte[0];
        }
    }
    
    public static Returned<Digest> of(String algorithm) {
        return switch (algorithm) {
            case "SHA-256" -> new Returned.ReturnValue(new SHA256());
            case "SHA-512" -> new Returned.ReturnValue(new SHA512());
            default -> new Returned.ErrorCode(-1);
        };
    }
}
